package com.example.mapper;

import com.example.handler.DynamicSqlProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;
import java.util.Map;

@Mapper
public interface DynamicSqlMapper {


    // 2. 使用@SelectProvider执行动态SQL
    @SelectProvider(type = DynamicSqlProvider.class, method = "executeRawSql")
    List<Map<String, Object>> executeRawSql(@Param("sql") String sql);

    // 2. 使用@SelectProvider执行动态SQL
    @SelectProvider(type = DynamicSqlProvider.class, method = "executeRawSql2")
    List<Map<String, Object>> executeRawSql2(@Param("id") Integer id);


    // 2. 使用@SelectProvider执行动态SQL
    @SelectProvider(type = DynamicSqlProvider.class, method = "executeSqlByMap")
    List<Map<String, Object>> executeSqlByMap(Map<String, Object> map);
}
